import type { AnyObj } from '@/types/global';
import { http } from '@/utils/http';
import { useAuthStore } from '@/stores';
import { isLogin, getWxUserId } from '@/utils/auth';


export const getLawfirmList = (data : AnyObj) => {
	const wxUserId = getWxUserId();
	if (isLogin() && wxUserId) {
		data.wxUserId = wxUserId;
	}
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/lawfirm/list`,
		data
	});
}

export const getLawyerDetail = (id : string) => {
	return http<AnyObj>({
		method: 'GET',
		url: `/wx/lawfirm/lawyer/${id}`
	});
}

export const getLawfirmDetail = (lawFirmId : string) => {
	return http<AnyObj>({
		method: 'GET',
		url: `/wx/lawfirm/${lawFirmId}`
	});
}

export const getLawfirmCaseList = (lawFirmId : string) => {
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/lawfirm/listCase/${lawFirmId}`,
	});
}

export const getLawfirmAwardList = (lawFirmId : string) => {
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/lawfirm/listAward/${lawFirmId}`,
	});
}

export const getLawfirmTagList = () => {
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/lawfirm/listTag`,
	});
}


export const getLawfirmCommentList = (data : AnyObj) => {
	const wxUserId = getWxUserId();
	if (isLogin() && wxUserId) {
		data.wxUserId = wxUserId;
	}
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/lawfirm/listComment`,
		data
	});
}


export const getLawyerListOfLaw = (lawFirmId : string) => {
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/lawfirm/listLawyer/${lawFirmId}`,
	});
}

export const getCaseDetail = (id : string) => {
	return http<AnyObj>({
		method: 'GET',
		url: `/wx/lawfirm/case/${id}`,
	});
}


export const getHonorDetail = (id : string) => {
	return http<AnyObj>({
		method: 'GET',
		url: `/wx/lawfirm/award/${id}`,
	});
}

export const getLawfirmExpertiseList = () => {
	return http<AnyObj[]>({
		method: 'GET',
		url: `/wx/lawfirm/listExpertise`,
	});
}
